package xl.utils
{
	import xl.struct.XArray;


	/**
	 * 国际化管理类
	 * @author xiling
	 *
	 */
	public class I18n
	{
		//常用按钮
		public static var BTN_OK:String="确定";
		public static var BTN_CANCEL:String="取消";
		public static var BTN_ACCEPT:String="接受";
		public static var BTN_AGREE:String="同意";
		public static var BTN_REFUSE:String="拒绝";
		public static var BTN_YES:String="是";
		public static var BTN_NO:String="否";
		public static var BTN_CLOSE:String="关闭";
		public static var BTN_BACK:String="返回";
		public static var BTN_EXIT:String="退出";
		public static var BTN_PREV_PAGE:String="上一页";
		public static var BTN_NEXT_PAGE:String="下一页";
		public static var BTN_VIEW:String="查看";
		public static var BTN_QUERY:String="查询";
		public static var BTN_SEARCH:String="搜索";
		public static var BTN_BUY:String="购买";
		public static var BTN_SALE:String="出售";
		public static var BTN_COPY:String="复制";
		public static var BTN_ADD:String="添加";
		public static var BTN_DELETE:String="删除";
		public static var BTN_SET:String="设置";
		public static var BTN_BUILD:String="建造";
		public static var BTN_UPGRADE:String="升级";
		public static var BTN_REPAIR:String="维修";
		public static var BTN_SPEEDUP:String="加速";
		public static var BTN_BREAK:String="拆除";
		public static var BTN_MIN:String="最小";
		public static var BTN_MAX:String="最大";
		public static var BTN_AUTO:String="自动";
		public static var BTN_MANUAL:String="手动";
		public static var BTN_COMPLETE:String="完成";
		public static var BTN_CONTINUE:String="继续";
		public static var BTN_SAVE:String="保存";
		public static var BTN_RECHARGE:String="充值";
		//常用字符串
		public static var LEVEL:String; //级
		public static var Neutral:String; //中立
		public static var Hostile:String; //敌对
		public static var SELF:String; //自己
		public static var UnknownSign:String; //未知信息
		public static var Nothing:String; //无
		//常用符号
		public static var SymbolColon:String; //冒号
		public static var SymbolFullstop:String; //句号
		public static var SymbolComma:String; //逗号
		public static var SymbolPlus:String; //加好
		public static var SymbolSub:String; //减号
		public static var SymbolBracketL:String; //左括号
		public static var SymbolBracketR:String; //右括号
		//日期相关
		public static var Date_YEAR:String;
		public static var Date_MONTH:String;
		public static var Date_DATE:String;

		public function I18n()
		{
		}

		/**
		 *  国际化资源初始化
		 *
		 */
		public static function init(str:String):void
		{
			Language.initLanguage(str, initConstStr);
		}

		public static function initConstStr():void
		{
			var darr:XArray=new XArray(getLocaleStr("CommonButton"));
			BTN_OK=darr.readString();
			BTN_CANCEL=darr.readString();
			BTN_ACCEPT=darr.readString();
			BTN_AGREE=darr.readString();
			BTN_REFUSE=darr.readString();
			BTN_YES=darr.readString();
			BTN_NO=darr.readString();
			BTN_CLOSE=darr.readString();
			BTN_BACK=darr.readString();
			BTN_EXIT=darr.readString();
			BTN_PREV_PAGE=darr.readString();
			BTN_NEXT_PAGE=darr.readString();
			BTN_VIEW=darr.readString();
			BTN_QUERY=darr.readString();
			BTN_SEARCH=darr.readString();
			BTN_BUY=darr.readString();
			BTN_SALE=darr.readString();
			BTN_COPY=darr.readString();
			BTN_ADD=darr.readString();
			BTN_DELETE=darr.readString();
			BTN_SET=darr.readString();
			BTN_BUILD=darr.readString();
			BTN_UPGRADE=darr.readString();
			BTN_REPAIR=darr.readString();
			BTN_SPEEDUP=darr.readString();
			BTN_BREAK=darr.readString();
			BTN_MIN=darr.readString();
			BTN_MAX=darr.readString();
			BTN_AUTO=darr.readString();
			BTN_MANUAL=darr.readString();

			darr.init(getLocaleStr("CommonStr"));
			LEVEL=darr.readString();
			Neutral=darr.readString();
			Hostile=darr.readString();
			SELF=darr.readString();
			UnknownSign=darr.readString();
			Nothing=darr.readString();

			darr.init(getLocaleStr("Symbol"));
			SymbolColon=darr.readString();
			SymbolFullstop=darr.readString();
			SymbolComma=darr.readString();
			SymbolPlus=darr.readString();
			SymbolSub=darr.readString();
			SymbolBracketL=darr.readString();
			SymbolBracketR=darr.readString();

			darr.init(getLocaleStr("DateStr"));
			Date_YEAR=darr.readString();
			Date_MONTH=darr.readString();
			Date_DATE=darr.readString();
		}

		/**
		 * 取得指定的语言文字
		 * @param flag 字符标记
		 * @param flagStrArr 替换字符代号数组
		 * @param replaceStrArr 替换对应字符数组
		 * @return
		 *
		 */
		public static function getLocaleStr(flag:String, format:Array=null):String
		{
			return Language.getString(flag, format);
		}
	}
}
